/**
涉及角色
抽象组件：定义一个抽象接口，来规范准备附加功能的类。
具体组件：将要被附加功能的类，实现抽象构件角色接口。
抽象装饰者：持有对具体构件角色的引用并定义与抽象构件角色一致的接口。
具体装饰：实现抽象装饰者角色，负责为具体构件添加额外功能。

代码实现：
Drink.java
SoyaBeanMilk.java
EggDecorator.java
SugarDecorator.java
BlackBeanDecorator.java
Decorator.java
Test.java

 */
/*
package com.leo.第八章_文件与IO;

public class U8_L17_包装者模式 {
	public static void main(String[] args) {
		Drink d=new Milk();
		Sugar s=new Sugar(d);
		Blackbean b=new Blackbean(s);
		System.out.println(b.cost());
		System.out.println(b.description());
	}
}

interface Drink{
	float cost();
	String description();
}

class Milk implements Drink{
	public float cost() {
		return 10.00f;
	}
	public String description() {
		return "原料： 牛奶";
	}
}

abstract class Decrator implements Drink{
	public Drink drink;
	public Decrator(Drink drink) {
		this.drink=drink;
	}
	public float cost() {
		return drink.cost();
	}
	
	public String description() {
		return drink.description();
	}
}

class Sugar extends Decrator{
	public Sugar(Drink drink) {
		super(drink);
	}
	public float cost() {
		return super.cost()+0.5f;
	}
	public String description() {
		return super.description()+"+糖";
	}
}
class Blackbean extends Decrator{
	public Blackbean(Drink drink) {
		super(drink);
	}
	public float cost() {
		return super.cost()+2.00f;
	}
	public String description() {
		return super.description()+"+黑豆";
	}
}
*/